import {
  defineConfig,
  presetAttributify,
  presetIcons,
  presetTypography,
  presetUno,
  presetWebFonts,
  presetWind,
  transformerDirectives,
  transformerVariantGroup
} from 'unocss'

export default defineConfig({
  shortcuts: [
    // 常用布局快捷方式
    ['flex-center', 'flex items-center justify-center'],
    ['flex-between', 'flex items-center justify-between'],
    ['flex-col-center', 'flex flex-col items-center justify-center'],
    ['absolute-center', 'absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2'],

    // 常用间距快捷方式
    ['p-safe', 'p-4'],
    ['m-safe', 'm-4'],
    ['px-safe', 'px-4'],
    ['py-safe', 'py-4']
  ],

  presets: [
    presetUno(),
    presetWind(),
    presetAttributify(),
    presetIcons({
      scale: 1.2,
      warn: true
    }),
    presetTypography(),
    presetWebFonts({
      fonts: {
        sans: 'Inter:400,600,800',
        mono: ['Fira Code', 'Fira Mono:400,700']
      }
    })
  ],

  transformers: [transformerDirectives(), transformerVariantGroup()]
})
